/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
/*******************************************************************************
    FILE NAME:		ecan_types.h

    PROJECT:		Linux ECAN527/1000 driver, library, and sample programs

    FILE DESCRIPTION:	This header file contains integral type definitions.

    Copyright (c) 2004 RTD Embedded Technologies, Inc.

    For driver version, compiler, and target information, please refer to the
    file README.TXT.
*******************************************************************************/

#ifndef  _ECAN_TYPES_H
# define _ECAN_TYPES_H

# if !defined(HAVE_LONGLONG) && defined(__GNUC__) && !defined(__STRICT_ANSI__)
#  define HAVE_LONGLONG
# endif

# include <arch.h>

# ifdef __KERNEL__
#  include <linux/types.h>
# else
#  include <sys/types.h>
# endif


# if defined(__GNUG__) && (__GNUG__>2 || (__GNUG__==2 && __GNUC_MINOR__>=6))
   const bool On  = true;
   const bool Off = false;
# else
   enum __DFCOMMON_BOOL__
   {
#  if !defined false && !defined true
	false=0, true=1,
#   define false false
#   define true  true
#  endif
	Off=false, On=true
   };
#  if	/* [n]curses typedefs bool */ \
		!defined bool   && !defined CXX_TYPE_OF_BOOL && \
		!defined CURSES	&& !defined CURSES_H && !defined _CURSES_H
    /* typedef enum __DFCOMMON_BOOL__ bool; */
#   define bool enum __DFCOMMON_BOOL__
#  endif
# endif


# ifdef __8_T
typedef unsigned __8_T  u8_t;
typedef   signed __8_T  s8_t;
# endif

# ifdef __16_T
typedef unsigned __16_T u16_t;
typedef   signed __16_T s16_t;
# endif

# ifdef __32_T
typedef unsigned __32_T u32_t;
typedef   signed __32_T s32_t;
# endif

# ifdef __64_T
typedef unsigned __64_T u64_t;
typedef   signed __64_T s64_t;
# endif


typedef unsigned __WORD_T word_t;


# if !defined intptr_t && !defined __intptr_t_defined
   typedef __INTPTR_T           intptr_t;
#  define    intptr_t           intptr_t
#  define  __intptr_t_defined __intptr_t_defined

   typedef unsigned __INTPTR_T uintptr_t; /* glibc does this way */
#  if !defined uintptr_t && !defined __uintptr_t_defined
#   define   uintptr_t           uintptr_t
#   define __uintptr_t_defined __uintptr_t_defined
#  endif
# endif



typedef       unsigned char   byte_t;
typedef       unsigned char*  byteptr_t;
typedef const unsigned char* cbyteptr_t;



typedef ulong      io_addr_t;	/* any type I/O address */

/* should be moved to <dfcommon/arch.h> */
# if   #cpu (i386)

typedef u16_t port_io_addr_t;
typedef u32_t  mem_io_addr_t;
typedef  u8_t          irq_t;
typedef  u8_t          drq_t;

# elif #cpu (alpha)

typedef u32_t port_io_addr_t;
typedef u32_t  mem_io_addr_t;
typedef  u8_t          irq_t;
typedef  u8_t          drq_t;

# else
#  warning this #cpu unsupported yet

typedef ulong port_io_addr_t;
typedef ulong  mem_io_addr_t;
typedef ulong          irq_t;
typedef ulong          drq_t;

# endif


typedef void* ptr_t;
typedef const void* const_ptr_t;
typedef const_ptr_t cptr_t;

typedef unsigned char	uchar;
typedef   signed char	schar;
typedef   signed short	sshort;
typedef   signed long	slong;
typedef   signed int	sint;

# if !defined(_LINUX_TYPES_H) && (!defined(__GLIBC__) || !defined(__USE_MISC))
typedef unsigned short	ushort;
typedef unsigned long	ulong;
typedef unsigned int	uint;
# endif


# ifdef HAVE_LONGLONG
typedef          long long int	 longlong;
typedef unsigned long long int	ulonglong;
typedef   signed long long int	slonglong;
# endif


# define HAVE_LONGDOUBLE	/* $$$$ */
# ifdef  HAVE_LONGDOUBLE
typedef long double ldouble;
# endif


#endif	/* _ECAN_TYPES_H */
